{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "83370958",
   "metadata": {},
   "source": [
    "# 1.集合\n",
    "* 1.集合的创建\n",
    "* 2.集合的方法"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a0856aa5",
   "metadata": {},
   "source": [
    "### 1.1 集合的创建"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "91288569",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['李鹏', '小明', '小红', '张力']\n",
      "<class 'list'>\n"
     ]
    }
   ],
   "source": [
    "街舞社 = [\"李鹏\",\"小明\",\"小红\",\"张力\"]\n",
    "print(街舞社)\n",
    "print(type(街舞社))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "669e8c31",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['Marry', 'Jack', 'John', 'Jessa', '李鹏']\n",
      "<class 'list'>\n"
     ]
    }
   ],
   "source": [
    "合唱团 = [\"Marry\",\"Jack\",\"John\",\"Jessa\",\"李鹏\"]\n",
    "print(合唱团)\n",
    "print(type(合唱团))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ab171512",
   "metadata": {},
   "source": [
    "### 1.2 集合的一般方法\n",
    "\n",
    "> 1. 交集\n",
    "> 2. 并集\n",
    "> 3. 差集"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "8e1cc106",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name '街舞社' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[1], line 2\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[38;5;66;03m# 交集的运算\u001b[39;00m\n\u001b[1;32m----> 2\u001b[0m 街舞社\u001b[38;5;241m.\u001b[39mintersection(合唱团)\n",
      "\u001b[1;31mNameError\u001b[0m: name '街舞社' is not defined"
     ]
    }
   ],
   "source": [
    "# 交集的运算\n",
    "街舞社.intersection(合唱团)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "110974e9",
   "metadata": {},
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "unsupported operand type(s) for &: 'list' and 'list'",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[7], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m 街舞社 \u001b[38;5;241m&\u001b[39m 合唱团\n",
      "\u001b[1;31mTypeError\u001b[0m: unsupported operand type(s) for &: 'list' and 'list'"
     ]
    }
   ],
   "source": [
    "街舞社 & 合唱团"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "4e3f6472",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name '街舞社' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[1], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m 街舞社\u001b[38;5;241m.\u001b[39munion(合唱团)\n",
      "\u001b[1;31mNameError\u001b[0m: name '街舞社' is not defined"
     ]
    }
   ],
   "source": [
    "街舞社.union(合唱团)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c70fbec8",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
